// 将list转换成树
export default {
  buildTree: function (list) {
    let newList = []
    if (list && list instanceof Array && list.length > 1) {
      for (let i1 in list) {
        let mark = false
        for (let i2 in list) {
          if (i1.parentId && i1.parentId === i2.id) {
            mark = true
            if (!i2.children) {
              i2.children = []
            }
            i2.children.push(i1)
            break
          }
        }
        if (!mark) {
          newList.push(i1)
        }
      }
    } else {
      return list
    }
  }
}
